import { Controller } from '@/controller'

export function addAuthorization(input: RequestInfo | URL, init?: RequestInit): { input: RequestInfo | URL, init?: RequestInit } {

    // 获取授权信息
    const token = Controller.instance.token;
    if (token) {
        init = {
            ...init,
            headers: {
                ...init?.headers,
                'Authorization': token,
            }
        }
    }
    return { input, init }
}